﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleDemo
{
    interface Eat
    {
        void PrintEat();
    }
    interface Run
    {
        void PrintRun(string _name);
    }
    public class Pet : Eat, Run
    {
        public string Name { get; set; }
        public void PetName(string name)
        {
            this.Name = name;
            Console.WriteLine("宠物的名字："+Name);
        }
        //隐式实现
        public virtual void  PrintEat()
        {
            Console.WriteLine("宠物会吃");
            
        }

        //显示实现
        void Run.PrintRun(string _name)
        {
            Console.WriteLine("你的宠物名字是{0}",_name+"他会跑");
            
        }

    }
    class Dog:Pet
    {
        public override void PrintEat()
        {
            
            base.PetName("二哈");
            Console.WriteLine("我的宠物是一只狗，爱吃骨头");
                    
        }
    }
  
}
